class SearchController < ApplicationController
  
  layout 'two_column'
  
  before_filter :find_tagged, :only => [ :find ]
  
  protected
  def find_tagged
    @tag = Tag.find(params[:term], :first)
    @results = Array.new
    @tag.taggings.each {|tagging| @results << tagging.taggable} unless @tag.nil?
  end
  
  public
  def find
    respond_to do |format|
      format.html
      format.xml  { render :xml => @results }
    end
  end
end
